JBoss Community Archive (Read Only)

SwitchYard 0.7

SQL Binding

The sql binding in SwitchYard provides database read/write support for references in SwitchYard.

The file binding is built on top of camel-sql.

SwitchYard 0.7

This binding have it's own namespace. To use it you must declare namespace with uri urn:switchyard-component-camel-sql:config:1.0. Your Maven project should also have following dependency:

  <dependency>
      <groupId>org.switchyard.components</groupId>
      <artifactId>switchyard-component-camel-sql</artifactId>
      <version>SWITCHYARD-VERSION</version>
  </dependency>

SQL Binding options

Following options can be apiled to <binding.sql> definition:

  • query : SQL query to execute

  • dataSourceRef : data source name

  • batch : turn on JDBC batching

  • placeholder : a placeholder sign used to replace parameters in query

For detailed description of these parameters please visit camel-sql site.

Binding References with database

Logically database is external resource from SwitchYard point of view. So there is no way to receive signals from database. To read data periodically please use SQL Binding together with Timer Binding or Quartz Binding.

<sca:composite name="camel-binding" targetNamespace="urn:switchyard-quickstart:camel-binding:0.1.0">
    <sca:reference name="GreetingDatabaseStore" promote="camel-binding/GreetingDatabaseStore" multiplicity="1..1">
        <camel:binding.sql>
            <camel:query>INSERT INTO greetings (name) VALUES (#)</camel:query>
            <camel:dataSourceRef>java:jboss/datasources/GreetDS</camel:dataSourceRef>
        <camel:binding.sql>
    </sca:reference>
    <sca:reference name="GreetingDatabaseRetrieve" promote="camel-binding/GreetingDatabaseRetrieve" multiplicity="1..1">
        <camel:binding.sql>
            <camel:query>INSERT INTO greetings (name) VALUES (#)</camel:query>
            <camel:dataSourceRef>java:jboss/datasources/GreetDS</camel:dataSourceRef>
        <camel:binding.sql>
    </sca:reference>
</sca:composite>
JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-13 09:47:13 UTC, last content change 2012-12-28 14:47:35 UTC.